package com.demo.design.factory;


import lombok.extern.slf4j.Slf4j;
import sun.net.idn.Punycode;

/**
 * @author xxg
 */
public class MethodFactory {
    public static void main(String[] args) {
        introCar(new ToyotaMarcket());
        introCar(new KiaMarket());

    }
    public  static void introCar(MarketFactory  m){
        m.getCarInfo().getInfo();
    }

}
interface  CarFactory{
    void getInfo();
}
interface  MarketFactory{
    CarFactory getCarInfo();
}
@Slf4j
class  Corolla implements CarFactory{
    {
        log.info("your Corolla is ready");
    }
    @Override
    public void getInfo() {
        log.info("日产卡罗拉");
    }
}
@Slf4j
class  K3 implements CarFactory{
    {
        log.info("your k3 is ready");
    }
    @Override
    public void getInfo() {
        log.info("韩系k3");
    }
}
class  ToyotaMarcket implements  MarketFactory{
    @Override
    public CarFactory getCarInfo() {
        return new Corolla();
    }
}
class KiaMarket implements  MarketFactory{
    @Override
    public CarFactory getCarInfo() {
        return new K3();
    }
}


